home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1999 April / Cd Pc Users extra 19 abril 1999.iso / Prog / Inst / addin / Main.bas < prev    next >
Encoding:
BASIC Source File  |  1996-10-27  |  1.9 KB  |  46 lines

  1. Attribute VB_Name = "MainModule"
  2. ' ************************************************
  3. ' Property setter main program.
  4. '
  5. ' This add-in allows the user to set any
  6. ' properties for a selected group of controls.
  7. ' ************************************************
  8. Option Explicit
  9.  
  10. #If Win16 Then
  11.     Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
  12.     Declare Function WritePrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lplFileName As String) As Integer
  13. #Else
  14.     Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
  15.     Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
  16. #End If
  17.  
  18. ' ************************************************
  19. ' The Main subroutine.
  20. ' ************************************************
  21. Sub Main()
  22. Dim section As String
  23. Dim val As String * 256
  24. Dim length As Long
  25.  
  26.     ' Check the correct section of VB.INI.
  27.     #If Win16 Then
  28.         section = "Add-Ins16"
  29.     #Else
  30.         section = "Add-Ins32"
  31.     #End If
  32.     
  33.     ' See if the PropertySetter.PropSet entry is
  34.     ' in VB.INI.
  35.     length = GetPrivateProfileString(section, _
  36.         "PropertySetter.PropSet", "", val, _
  37.         256, "VB.INI")
  38.     
  39.     ' If not, add it.
  40.     If length = 0 Then
  41.         WritePrivateProfileString section, _
  42.             "PropertySetter.PropSet", "0", _
  43.             "VB.INI"
  44.     End If
  45. End Sub
  46.